package com.surprise.base.util;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class URLUtils {
    public static String urlEncode(String url) {
        return URLEncoder.encode(url);
    }

    public static String urlEncode(String url, String enc)
            throws UnsupportedEncodingException {
        return URLEncoder.encode(url, enc);
    }

    public static String urlDecode(String url) {
        return URLDecoder.decode(url);
    }

    public static String urlDecode(String url, String enc)
            throws UnsupportedEncodingException {
        return URLDecoder.decode(url, enc);
    }

    public static void main(String args[]) {
        // System.out.println(urlEncode("http://images.xiustatic.com/upload/goods20140411/81082949/810829490001/ori1.jpg"));
        System.out
                .println(urlDecode("%E5%B0%8F%E7%B1%B3%E6%8B%89%E5%8D%A1%E6%8B%89%E5%88%B7%E5%8D%A1%E5%99%A8+%E7%99%BD%E8%89%B2"));
    }
}
